package com.tedu.demo;

public class Test03_Runncble {
    public static void main(String[] args) {
        //测试
        //创建对象
        MyRunncble target = new MyRunncble();
        //构建关系
        Thread d = new Thread(target,"线程1");
        Thread d1 = new Thread(target,"线程2");
        Thread d2 = new Thread(target,"线程3");
        d.start();
        d1.start();
        d2.start();
    }
}
class MyRunncble implements Runnable {

    @Override
    public void run() {
        //Thread.currentThread() -- 获取正在执行任务的线程
        for (int i = 0; i < 20; i++) {
            System.out.println(Thread.currentThread().getName());
        }
    }
}